package com.example.demo.service;

import com.example.demo.dao.BookDao;
import com.example.demo.modal.BookInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class BookService {
    @Autowired
    private BookDao bookDao;
    public List<BookInfo> getList() {
//        BookDao bookDao = new BookDao();
        List<BookInfo> bookInfos = bookDao.mockData();
        for (BookInfo bookInfo : bookInfos) {
            if (bookInfo.getStatus() == 1) {
                bookInfo.setStatusCN("已借阅");
            } else {
                bookInfo.setStatusCN("未借阅");
            }
        }
        return bookInfos;
    }
}
